import { request } from '@/amtf/utils/request.js'

export default function(url = '') {
	if (!url) {
		url = "/lysd/gouwuche"
	}

	const 增 = (data) => {
		return request({
			url,
			method: 'post',
			data
		});
	}
	const 删 = (params) => {
		return request({
			url,
			method: 'delete',
			params
		});
	}
	const 查 = (params = {}) => {
		params.仅自己 = true
		return request({
			url,
			method: 'get',
			params
		});
	}

	const 查字段值选项集 = (params) => {
		return request({
			url: url + "/查字段值选项集",
			method: 'get',
			params
		});
	}

	const 取字段值选项集 = (params) => {
		return request({
			url: url + "/A取选项集",
			method: 'get',
			params
		});
	}

	const 改 = (data) => {
		// console.log(`改 data ??`, data)
		return request({
			url,
			method: 'put',
			data
		})
	}

	const 下单 = (data) => {
		// console.log(`改 data ??`, data)
		return request({
			url: url + "/dingdan",
			method: 'post',
			data
		})
	}

	return { 增, 删, 改, 查, 查字段值选项集, 下单 }
}